﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Samples.ServiceHosting.StorageClient;
using Ciripescu_WebRole.BL;

namespace Ciripescu_WebRole.Entities
{
    public class User : TableStorageEntity
    {
        #region Public Methods        

        public User() { }

        public User(string userName)
            : base(userName, String.Empty)
        {
            this.Version = Properties.Settings.Default.Version;
            this.LastCirip = DateTime.Now;
            
            this.OneLineBio = String.Empty;
            this.Hi5URL     = String.Empty;
            this.TaggedURL  = String.Empty;
            this.InfoURL    = String.Empty;
            this.Location   = String.Empty;

            this.NrUrmariti   = 0;
            this.NrUrmaritori = 0;

            this.Votes = 0;
            this.Group = 0;
        }

        public User(string fullName,
                    string username, 
                    string password,
                    string email,
                    string IP)
            : base(username, String.Empty)
        {
            this.FullName = fullName;
            this.Password = Utils.MD5Crypt(password);
            this.Email    = email;
            this.Version  = Properties.Settings.Default.Version;
            this.IP       = IP;
            this.LastCirip = DateTime.Now;

            this.OneLineBio = String.Empty;
            this.Hi5URL     = String.Empty;
            this.TaggedURL  = String.Empty;
            this.InfoURL    = String.Empty;
            this.Location   = String.Empty;

            this.NrUrmariti   = 0;
            this.NrUrmaritori = 0;

            this.Votes = 0;
            this.Group = 0;
        }

        public string GetUserName()
        {
            return this.PartitionKey;
        }
        #endregion 

        #region Public Properties

        public string FullName { get; set; }
        public string Password { get; set; }
        public string Email    { get; set; }
        public string IP { get; set; }
        public string Version { get; set; }
        public string InfoURL { get; set; }
        public string OneLineBio { get; set; }
        public string Hi5URL { get; set; }
        public string TaggedURL { get; set; }
        public string Location { get; set; }
        public string PictureBlobId { get {return m_blobId;} set {m_blobId = value;} }
        public string PictureUri { get; set; }
        public DateTime LastCirip { get; set; }
        public long NrUrmaritori { get; set; }
        public long NrUrmariti { get; set; }
        public bool EmailWhenFollowMe { get; set; }
        public bool EmailWhenDirectMsg { get; set; }
        public int Votes { get; set; }
        public int Group { get; set; }
        public string Username { 
            get
            {
                return this.PartitionKey;
            }
            set
            {
                this.PartitionKey = value;
            }
        }

        #endregion 

        #region Private Methods
        
        
        #endregion 

        #region Private Members

        private string m_blobId = String.Empty;
        #endregion 
    }
}
